<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Newton Dynamics: dMemory Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo_php.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Newton Dynamics
   &#160;<span id="projectnumber">4.00</span>
   </div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.svg"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classd_memory.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="classd_memory-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">dMemory Class Reference</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a4e00fab80f4de696dc7877929c50a770"><td class="memItemLeft" align="right" valign="top">static D_CORE_API void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classd_memory.html#a4e00fab80f4de696dc7877929c50a770">Malloc</a> (size_t size)</td></tr>
<tr class="memdesc:a4e00fab80f4de696dc7877929c50a770"><td class="mdescLeft">&#160;</td><td class="mdescRight">General Memory allocation function.  <a href="classd_memory.html#a4e00fab80f4de696dc7877929c50a770">More...</a><br /></td></tr>
<tr class="separator:a4e00fab80f4de696dc7877929c50a770"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a56b05108042ab6faabcd1bbe0fb91394"><td class="memItemLeft" align="right" valign="top"><a id="a56b05108042ab6faabcd1bbe0fb91394"></a>
static D_CORE_API void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classd_memory.html#a56b05108042ab6faabcd1bbe0fb91394">Free</a> (void *const ptr)</td></tr>
<tr class="memdesc:a56b05108042ab6faabcd1bbe0fb91394"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a memory buffer previously allocated by Malloc. <br /></td></tr>
<tr class="separator:a56b05108042ab6faabcd1bbe0fb91394"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af8e0900cdee29fc47385739777e25fbf"><td class="memItemLeft" align="right" valign="top"><a id="af8e0900cdee29fc47385739777e25fbf"></a>
static D_CORE_API dUnsigned64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classd_memory.html#af8e0900cdee29fc47385739777e25fbf">GetMemoryUsed</a> ()</td></tr>
<tr class="memdesc:af8e0900cdee29fc47385739777e25fbf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the total memory allocated by the newton engine and tools. <br /></td></tr>
<tr class="separator:af8e0900cdee29fc47385739777e25fbf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afd574e2f624e7838c6e66dbd9bae9341"><td class="memItemLeft" align="right" valign="top">static D_CORE_API void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classd_memory.html#afd574e2f624e7838c6e66dbd9bae9341">SetMemoryAllocators</a> (dMemAllocCallback alloc, dMemFreeCallback free)</td></tr>
<tr class="memdesc:afd574e2f624e7838c6e66dbd9bae9341"><td class="mdescLeft">&#160;</td><td class="mdescRight">Install low level system memory allocation functions.  <a href="classd_memory.html#afd574e2f624e7838c6e66dbd9bae9341">More...</a><br /></td></tr>
<tr class="separator:afd574e2f624e7838c6e66dbd9bae9341"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a4e00fab80f4de696dc7877929c50a770"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4e00fab80f4de696dc7877929c50a770">&#9670;&nbsp;</a></span>Malloc()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void * dMemory::Malloc </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>General Memory allocation function. </p>
<p>All memory allocations used by the Newton Engine and Tools are performed by calling this function. </p>

</div>
</div>
<a id="afd574e2f624e7838c6e66dbd9bae9341"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afd574e2f624e7838c6e66dbd9bae9341">&#9670;&nbsp;</a></span>SetMemoryAllocators()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void dMemory::SetMemoryAllocators </td>
          <td>(</td>
          <td class="paramtype">dMemAllocCallback&#160;</td>
          <td class="paramname"><em>alloc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">dMemFreeCallback&#160;</td>
          <td class="paramname"><em>free</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Install low level system memory allocation functions. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dMemAllocCallback</td><td>alloc: is a function pointer callback to allocate a memory chunk. </td></tr>
    <tr><td class="paramname">dMemFreeCallback</td><td>free: is a function pointer callback to free a memory chunk.</td></tr>
  </table>
  </dd>
</dl>
<p>All memory allocated by alloc, does not need to be aligned, therefore an application can write them using standard malloc and free. By default the memory allocation is set to call the standard library functions malloc and free, however if an application wants to keep track of how memory is used, it must install the memory callbacks by calling this function before any class of the Newton Engine or tool was created or instantiated. The engine does not do any global allocation using global operators new and delete, therefore it is ok to install the memory allocator on the main of the application or just before start using the engine. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="classd_memory.html">dMemory</a></li>
    <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20 </li>
  </ul>
</div>
</body>
</html>
